import request from '@/utils/request'
import { qualityApiUrl } from '@/api/config.js'

// 重点监管质量风险监控计划 //
/**
 * 查询风险上报列表-所有的项目所有的风险上报列表
 * @param data
 */
export function getList(data) {
  return request({
    url: qualityApiUrl + '/quality/riskMonitorPlan/queryDetails',
    method: 'post',
    data: data
  })
}
/**
 * 获取根据项目id查询责任人、验证人
 * @param id
 */
export function riskMonitorPlangetEmoById(id) {
  return request({
    url: qualityApiUrl + `/quality/riskMonitorPlan/getEmoById/${id}`,
    method: 'get',
  })
}
/**
 * 历史版本
 * @param id
 */ 
export function getHistory(id) {
  return request({
    url: qualityApiUrl + `/quality/riskMonitorPlan/getHis/${id}`,
    method: 'get',
  })
}
/**
 * 查询单个项目计划
 * @param id
 */ 
export function getDetail(id, historyId = '-1', isView) {
  return request({
    url: qualityApiUrl + `/quality/riskMonitorPlan/${id}/${historyId}/${isView}`,
    method: 'get',
  })
}
/**
 * 修改项目计划
 * @param data
 */
export function updatePost(data) {
  return request({
    url: qualityApiUrl + '/quality/riskMonitorPlan/update',
    method: 'post',
    data: data
  })
}
/**
 * 调整项目计划
 * @param data
 */
export function adjustment(data) {
  return request({
    url: qualityApiUrl + '/quality/riskMonitorPlan/adjustment',
    method: 'post',
    data: data
  })
}
/**
 * 新增项目计划
 * @param data
 */
export function handleCreate(data) {
  return request({
    url: qualityApiUrl + '/quality/riskMonitorPlan/create',
    method: 'post',
    data: data
  })
}
/**
 * 统计总数
 * @param data
 */
export function count(data) {
  return request({
    url: qualityApiUrl + '/quality/riskMonitorPlan/statistics',
    method: 'post',
    data: data
  })
}

/**
 * 导出接口
 * @param data
 */
export function excels(id) {
  return request({
    url: qualityApiUrl + `/quality/riskMonitorPlan/excels/${id}`,
    method: 'get',
    responseType: 'blob'
  })
}
export const riskMonitorPlan = {
  excels,
  getList,
  count,
  getHistory,
  getDetail,
  handleCreate,
  updatePost,
  adjustment,
}


